import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import dayjs from 'dayjs';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '月份',
    align:"center",
    dataIndex: 'month',
    width: 80
  },
  {
    title: '年份',
    align:"center",
    dataIndex: 'year',
    width: 100
  },

 /* {
    title: '项目ID',
    align:"center",
    dataIndex: 'projectId',
    width: 200
  },*/
  {
    title: '项目名称',
    align:"left",
    dataIndex: 'projectName',
    width: 400
  },
  {
    title: '项目Id',
    align:"left",
    dataIndex: 'projectId'
  },
  {
    title: '项目序号',
    align:"left",
    dataIndex: 'sortNo'
  },
  {
    title: '项目状态',
    align:"center",
    dataIndex: 'projectStatus_dictText',
    width: 120
  },
  {
    title: '项目类型',
    align:"center",
    dataIndex: 'rocType',
    width: 80
  },
  {
    title: '合同额',
    align:"center",
    dataIndex: 'contractAmount',
    width: 100,
    format(_,record){
      return (record.contractAmount).toFixed(0)
    },
  },
  {
    title: '去税合同额',
    align:"center",
    dataIndex: 'contractAmountWithoutFax',
    format(_,record){
      return (record.contractAmountWithoutFax).toFixed(0)
    },
  },
  {
    title: '周期',
    align:"center",
    dataIndex: 'cycle',
    width: 80
  },
  {
    title: '执行天数',
    align:"center",
    dataIndex: 'excuteDays',
    width: 80
  },
  {
    title: '已消耗金额',
    align:"center",
    dataIndex: 'consume',
    width: 100,
    format(_,record){
      return (record.consume).toFixed(0)
    },
  },
  {
    title: '月销售额',
    align:"center",
    dataIndex: 'monthSell',
    width: 100,
    format(_,record){
      return (record.monthSell).toFixed(0)
    },
  },

  {
    title: '可支配预算',
    align:"center",
    dataIndex: 'dominateCost',
    width: 100,
    format(_,record){
      return (record.dominateCost).toFixed(0)
    },
  },
  {
    title: '累计已使用预算',
    align:"center",
    dataIndex: 'totalAmount',
    width: 120,
    format(_,record){
      return (record.totalAmount).toFixed(0)
    },
  },
/*
  {
    title: '剩余预算',
    align:"center",
    dataIndex: 'remainderCost',
    format(_,record){
      return (record.remainderCost).toFixed(0)
    },
  },
*/
  {
    title: '当月运营费',
    align:"center",
    dataIndex: 'operationMonthAmount',
    width: 120,
    format(_,record){
      return (record.operationMonthAmount).toFixed(0)
    },
  },
  {
    title: '当月差旅费用',
    align:"center",
    dataIndex: 'tripMonthAmount',
    width: 120,
    format(_,record){
      return (record.tripMonthAmount).toFixed(0)
    },
  },
  {
    title: '当月人员费',
    align:"center",
    dataIndex: 'hrMonthAmount',
    width: 100,
    format(_,record){
      return (record.hrMonthAmount).toFixed(0)
    },
  },
  {
    title: '当月第三方费用',
    align:"center",
    dataIndex: 'supMonthAmount',
    width: 120,
    format(_,record){
      return (record.supMonthAmount).toFixed(0)
    },
  },
  {
    title: '当月利润',
    align:"center",
    dataIndex: 'currentMonthProfit',
    width: 100,
    format(_,record){
      return (record.currentMonthProfit).toFixed(0)
    },
  },
/*  {
    title: '报告生成时间',
    align:"center",
    dataIndex: 'genernateTime'
  },*/
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '年份:',
    field: 'year',
    component: 'InputNumber',
    defaultValue: new Date().getFullYear(),
    colProps: { span: 2 },
  },
  {
    label: '月份:',
    field: 'month',
    component: 'InputNumber',
    defaultValue: dayjs().add(0, 'month').format('MM'),
    colProps: { span: 2 },
  },
  {
    label: '项目名称:',
    field: 'projectName',
    component: 'JInput',
    colProps: { span: 3 },
  },
  {
    label: '项目序号',
    field: 'sortNo',
    component: 'JInput',
    colProps: { span: 4 },
  },
  {
    field: 'customId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'monster_custom,name,id'
    },
    label: '所属客户',
    colProps: { span: 4 },
  },
  {
    label: '项目类型',
    field: 'rocType',
    component: 'JSelectInput',
    componentProps: {
      options: [
        { label: 'R类', value: 'R' },
        { label: 'C类', value: 'C' },
        { label: 'O类', value: 'O' },
      ],
    },
    colProps: { span: 3 },
    showAdvancedButton: true
  },

  {
    label: '项目状态',
    field: 'projectStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'projectStatus',
      stringToNumber: true,
    },
    colProps: { span: 4 },
  },

  {
    field: 'createBy',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'sys_user,realname,username'
    },
    label: '项目经理',
    colProps: { span: 4 },
  },

];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目类型',
    field: 'rocType',
    component: 'Input',
  },
  {
    label: '项目ID',
    field: 'projectId',
    component: 'Input',
  },
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
  },
  {
    label: '合同额',
    field: 'contractAmount',
    component: 'InputNumber',
  },
  {
    label: '去税合同额',
    field: 'contractAmountWithoutFax',
    component: 'InputNumber',
  },
  {
    label: '月收益',
    field: 'profit',
    component: 'InputNumber',
  },
  {
    label: '报告生成时间',
    field: 'genernateTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '月份',
    field: 'month',
    component: 'InputNumber',
  },
  {
    label: '年份',
    field: 'year',
    component: 'InputNumber',
  },
  {
    label: '当月运营费',
    field: 'operationMonthAmount',
    component: 'InputNumber',
  },
  {
    label: '当月差旅费用',
    field: 'tripMonthAmount',
    component: 'InputNumber',
  },
  {
    label: '当月第三方费用',
    field: 'supMonthAmount',
    component: 'InputNumber',
  },
  {
    label: '当月人员费',
    field: 'hrMonthAmount',
    component: 'InputNumber',
  },
  {
    label: '月销售额',
    field: 'monthSell',
    component: 'InputNumber',
  },
  {
    label: '累计已使用预算',
    field: 'totalAmount',
    component: 'InputNumber',
  },
  {
    label: '可支配预算',
    field: 'dominateCost',
    component: 'InputNumber',
  },
  {
    label: '已消耗金额',
    field: 'consume',
    component: 'InputNumber',
  },
  {
    label: '执行天数',
    field: 'excuteDays',
    component: 'InputNumber',
  },
  {
    label: '周期',
    field: 'cycle',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
